package com.whmskj.xjlhsc.stationmachine.service.imp;

import com.whmskj.xjlhbc.db.DataSource;
import com.whmskj.xjlhbc.db.DataSourceType;
import com.whmskj.xjlhsc.stationmachine.mapper.EnvironmentalTestingMapper;
import com.whmskj.xjlhsc.stationmachine.pojo.dto.EnvironmentalTestingDTO;
import com.whmskj.xjlhsc.stationmachine.pojo.vo.EnvironmentalTestingVO;
import com.whmskj.xjlhsc.stationmachine.service.EnvironmentalTestingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jiaruchun
 * @date 2025-09-18 16:59
 */
@Service
public class EnvironmentalTestingServiceImpl implements EnvironmentalTestingService {
    @Autowired
    private EnvironmentalTestingMapper environmentalTestingMapper;

    @Override
    @DataSource(DataSourceType.SC)
    public List<EnvironmentalTestingVO> getEnvironmentalTesting(List<EnvironmentalTestingDTO> environmentalTestingDTOList) {

        if(environmentalTestingDTOList == null || environmentalTestingDTOList.isEmpty()){
            //查全部
            return environmentalTestingMapper.selectAll();
        }else {
            //查部分
            return environmentalTestingMapper.selectByDeviceIdList(environmentalTestingDTOList);
        }
    }
}
